package com.ssm.web.controller;

import com.ssm.common.restful.Result;
import com.ssm.common.restful.ResultGenerator;
import com.ssm.common.utils.LocaleMessage;
import com.ssm.core.service.IStudentService;
import com.ssm.dal.entity.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RestController
public class HelloController {

    // private final static Logger log = LoggerFactory.getLogger(HelloWorldController.class);

    @Autowired
    private IStudentService studentService;

    @Autowired
    private LocaleMessage localeMessage;

    @GetMapping
    public String home() {
        log.info(localeMessage.getMessage("msg[0]"));
        return "home";
    }

    @GetMapping("hw")
    public UserVO hw(@Valid UserVO userVO) {
        return userVO;
    }

    @GetMapping("student")
    public Result listStudent() {
        log.info("hahahahah.................");
        // return ResultGenerator.genSuccessResult(studentService.listStudent());
        return ResultGenerator.genSuccessResult();
    }
}
